package filesLessons;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

public class MyXORInputStream extends FilterInputStream{
	InputStream in;
	public MyXORInputStream(InputStream in) {
		super(in);
		this.in= in;
	}
	@Override
	public int read() throws IOException{
			int r = in.read();
			
			return r!=-1?100:-1;
	}
	@Override
	public int read(byte cbuf[], int offset, int length) throws IOException {
		int r = in.read(cbuf,offset,length);
		
		for(byte i:cbuf){
			i= (byte)(i^100);
		}
		return r;
	
	}
	@Override
	public int read(byte b[]) throws IOException {
		int r = in.read(b,0,b.length);
			
		return r!=-1?100:-1;
	
	}
}
